package com.xoa.controller.workflow;

import com.sun.net.httpserver.HttpsServer;
import com.xoa.model.users.Users;
import com.xoa.service.syspara.SysParaService;
import com.xoa.util.CookiesUtil;
import com.xoa.util.common.session.SessionUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by 韩东堂 on 2017/5/11.
 */

@Controller
@RequestMapping("/workflow/formtype")
public class FlowFormTypePageController {

    @Resource
    SysParaService sysParaService;

    @RequestMapping("/index")
    public String showPage(HttpServletRequest request, Model model){
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        Users user= SessionUtils.getSessionInfo(request.getSession(), Users.class, new Users(),redisSessionCookie);
        if (!sysParaService.checkIsHaveSecure(user,8)){
            return "app/common/development";
        }
        return "app/workflow/formtype/index";
    }


    @RequestMapping("/control")
    public String control(HttpServletRequest request){

        return "app/workflow/formtype/control";
    }

    @RequestMapping("/mobileIndex")
    public String mobileIndex(HttpServletRequest request){
        return "app/workflow/formtype/mobile/index";
    }

}
